home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9820 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1022 b 

  1. Path: ccshst05.cs.uoguelph.ca!ccshst01!thay
  2. From: thay@uoguelph.ca (Toby K Hay)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: A question on for loop
  5. Date: 13 Mar 1996 19:23:54 GMT
  6. Organization: University of Guelph
  7. Message-ID: <4i77ca$161@ccshst05.cs.uoguelph.ca>
  8. References: <31471574.79D9@hdc-usa.com>
  9. NNTP-Posting-Host: ccshst01.cs.uoguelph.ca
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Phil Boyd (boydp@hdc-usa.com) wrote:
  13. : > |>
  14. : > |> for(i=0;i< 20; i++)
  15. : > |> {
  16. : > ...
  17. : > |>   if(condition==FALSE)
  18. : > |>   continue;
  19. : > ...
  20. : > |> }
  21.  
  22. : OK, now for a newbie question just for my own edification:
  23. : Inside the for loop - does "i" start off with the value 0 so that
  24. : the loop has the potential to repeat up to 20 times (assuming that
  25. : "condition" remains FALSE)?
  26.  
  27. My novice's answer is yes, i starts off at 0 because the for statement 
  28. (i=0;i<20;i++) has i++ meaning that i is incremented after the 
  29. operation.  If it were (i=0;i<20;++i) then i would start at 1 and run up 
  30. to 20.  Is this correct?
  31. Toby Hay   thay@uoguelph.ca
  32.